<%--
    Document   : AccountDetail
    Created on : 14/Jan/2010, 0:42:38
    Author     : Marco
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${requestScope['title']} - ${requestScope['action']}</title>
        <style type="text/css">
            body { font-family: Verdana, sans-serif; font-size:80%}
            table.t {
                border-color:black;
                border-style:solid;
                border-width:thin;
                padding:0;
                margin:0;
            }
            tr.l1 {
                background:lightblue;
                padding:0;
                margin:0;
            }
            tr.l2 {
                padding:0;
                margin:0;
            }
        </style>
    </head>
    <body>
        <h1>${requestScope['title']} - ${requestScope['action']}</h1>
        <form action="?action=${requestScope['formMethod']}" method="POST">
            <c:choose>
                <c:when test="${!empty requestScope['client']}">
                    <input type="hidden" name="clientId" value="${requestScope['client'].id}" />
                </c:when>
            </c:choose>
            <c:choose>
                <c:when test="${!empty requestScope['account']}">
                    <input type="hidden" name="accountId" value="${requestScope['account'].id}" />
                </c:when>
            </c:choose>
            <table>
                <tbody>
                    <tr>
                        <td colspan="2">Conta</td>
                    </tr>
                    <tr>
                        <td>Titular :</td>
                        <td>${requestScope['client'].name}</td>
                    </tr>
                    <tr>
                        <td>Nº Conta (Balcão/Número) :</td>
                        <td>${requestScope['account'].agency} / ${requestScope['account'].number}</td>
                    </tr>
                    <tr>
                        <td>Saldo (contabilistico/Disponivel)</td>
                        <td>${requestScope['account'].accountingBalance} &euro; / ${requestScope['account'].availableBalance} &euro;</td>
                    </tr>
                    <tr>
                        <td colspan="2"><input type="button" value="Voltar" onclick="this.form.action='client?action=detail'; this.form.submit();"/></td>
                    </tr>
                </tbody>
            </table>
                        <c:choose>
                            <c:when test="${!empty requestScope['movements']}">
                                <input type="hidden" name="clientId" value="" />
                                <table class="t">
                                    <thead>
                                        <tr>
                                            <th>Data Mov.</th>
                                            <th>Data Ef.</th>
                                            <th>Descrição</th>
                                            <th width="120">Valor</th>
                                            <th width="120">Saldo (Disp.)</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <c:forEach var="mov" items="${requestScope['movements']}" varStatus="loop">
                                            <tr class="${loop.index % 2 == 0 ? 'l1' : 'l2'}">
                                                <td>${mov.operationDate}</td>
                                                <td>${mov.efectiveDate}</td>
                                                <td>${mov.description}</td>
                                                <td align="right">${mov.movValue} &euro;</td>
                                                <td align="right">${mov.balance} &euro;</td>
                                            </tr>
                                        </c:forEach>
                                    </tbody>
                                </table>
                            </c:when>
                            <c:otherwise>
                                <div><span>Não existem movimentos.</span></div>
                            </c:otherwise>
                        </c:choose>
        </form>
    </body>
</html>
